//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>
package org.jpgolay.wi.group;

import java.io.Serializable;

public class Group
        implements Serializable {

    public Group() {
    }

    public Group(Integer id, String name, String role, String lastUpdate, String lastUser, String note) {
        setId(id);
        setName(name);
        setRole(role);
        setLastUpdate(lastUpdate);
        setLastUser(lastUser);
        setNote(note);
    }

    public Group(Group otherData) {
        setId(otherData.getId());
        setName(otherData.getName());
        setRole(otherData.getRole());
        setLastUpdate(otherData.getLastUpdate());
        setLastUser(otherData.getLastUser());
        setNote(otherData.getNote());
    }

    public Integer getPrimaryKey() {
        return getId();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getLastUpdate() {
        return lastUpdate;
    }

    public String getLastUser() {
        return lastUser;
    }

    public void setLastUpdate(String string) {
        lastUpdate = string;
    }

    public void setLastUser(String string) {
        lastUser = string;
    }

    public String toString() {
        StringBuffer str = new StringBuffer("{");
        str.append("id=" + getId() + " " + "name=" + getName() + " " + "role=" + getRole() + " " + "lastUpdate=" + getLastUpdate() + " " + "lastUser=" + getLastUser() + " " + "note=" + getNote());
        str.append('}');
        return str.toString();
    }

    public boolean equals(Object pOther) {
        if (pOther instanceof Group) {
            Group lTest = (Group) pOther;
            boolean lEquals = true;
            if (id == null) {
                lEquals = lEquals && lTest.id == null;
            } else {
                lEquals = lEquals && id.equals(lTest.id);
            }
            if (name == null) {
                lEquals = lEquals && lTest.name == null;
            } else {
                lEquals = lEquals && name.equals(lTest.name);
            }
            if (role == null) {
                lEquals = lEquals && lTest.role == null;
            } else {
                lEquals = lEquals && role.equals(lTest.role);
            }
            if (lastUpdate == null) {
                lEquals = lEquals && lTest.lastUpdate == null;
            } else {
                lEquals = lEquals && lastUpdate.equals(lTest.lastUpdate);
            }
            if (lastUser == null) {
                lEquals = lEquals && lTest.lastUser == null;
            } else {
                lEquals = lEquals && lastUser.equals(lTest.lastUser);
            }
            if (note == null) {
                lEquals = lEquals && lTest.note == null;
            } else {
                lEquals = lEquals && note.equals(lTest.note);
            }
            return lEquals;
        } else {
            return false;
        }
    }

    public int hashCode() {
        int result = 17;
        result = 37 * result + (id == null ? 0 : id.hashCode());
        result = 37 * result + (name == null ? 0 : name.hashCode());
        result = 37 * result + (role == null ? 0 : role.hashCode());
        result = 37 * result + (lastUpdate == null ? 0 : lastUpdate.hashCode());
        result = 37 * result + (lastUser == null ? 0 : lastUser.hashCode());
        result = 37 * result + (note == null ? 0 : note.hashCode());
        return result;
    }
    private Integer id;
    private String name;
    private String role;
    private String note;
    private String lastUpdate;
    private String lastUser;
}
